import E from 'wangeditor';
const { $, BtnMenu } = E;
var _this = null;

export default class AlertMenu extends BtnMenu {
  constructor(editor) {
    _this = editor;
    const $elem = E.$(
      `<div class="w-e-menu" data-title="视频">
                <div class="iconfont iconshipin"></div>
            </div>`,
    );
    super($elem, editor);
  }

  clickHandler() {
    const editor = _this;
    const videoUrl = prompt('请输入视频URL', 'https://');
    if (videoUrl) {
      editor.txt.append(`<video src="${videoUrl}" controls style="max-width:100%;"></video>`);
    }
  }

  tryChangeActive() {
    this.active();
  }
}
